package com.liyghting.test;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class ScannerDemo {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		List<String> strList = new ArrayList<>();
		while (scan.hasNextLine()) {
			String str = scan.nextLine();
			if (str.length() == 0) {
				break;
			}
			strList.add(str);
		}
		scan.close();
		for (String str : strList) {
			String[] s = str.split(" ");
			for (int i = s.length - 1; i >= 0; i--) {
				if (i == 0) {
					System.out.print(s[i]);
				} else {
					System.out.print(s[i] + " ");
				}
			}
			System.out.println();
		}

	}

}